home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CAImage.cpp
-
- Contains: Container Application Library source
-
- Written by: Tantek Çelik, Greg Ames, David Nelson, Steve Foley
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <8> 5/15/95 RB Adding CA_CATCH
- <7> 4/18/95 SJF Fix CAGetCanvas - note that the graphics
- System is preset to kODQuickDraw which is
- probably uncool!
- <5> 4/07/95 RB Fixed some ref counting errors
-
- <4> 3/30/95 RB Added routine CAForceUpdate(). Used by the app
- to force the update of a region, for scrolling.
-
- <3+> 2/28/95 SJF Add debug stuff to API calls
- <3> 2/13/95 SJF Interim checkin to update project database
- <2) 12/15/94 SJF change somGetGlobalEnvironment to _gpProxyShell->GetGlobalEnvironment
- <1> 12/12/94 SJF Fix up after adding TCAProxyShell stuff...
- <0> 10/30/94 GCA,DHN All mods to make project compile with no
- errors under OpenDoc b1 (with SOM).
- <_> 8/9/94 TÇ first written
-
- To Do:
- */
-
- #ifndef _CASESSN_
- #include "CASessn.h"
- #endif
-
- #ifndef _CAERROR_
- #include "CAError.h"
- #endif
-
- #ifndef _CADOCPRIV_
- #include "CADocPriv.h"
- #endif
-
- #ifndef _CAFRMUTL_
- #include "CAFrmUtl.h"
- #endif
-
- #ifndef SOM_ODFrame_xh
- #include <Frame.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- #ifndef SOM_ODCanvas_xh
- #include <Canvas.xh>
- #endif
-
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #ifndef _CAPROXYPARTDEF_
- #include "CAProxyPartDef.h"
- #endif
-
- #ifndef CAProxyExtension_API
- #include "CAProxyExtension.xh"
- #endif
-
- #ifndef SOM_ODFoci_xh
- #include <Foci.xh>
- #endif
-
- #ifndef _TEMPOBJ_
- #include <TempObj.h>
- #endif
-
- #pragma segment CALib
-
-
- //-------------------------------------------------------------------------
- // Imaging
- //-------------------------------------------------------------------------
-
- pascal GrafPtr
- CAGetCanvas( CAVisFrame visFrame, CAGraphicsSystem graphicsSystem)
- {
-
- Environment* ev = gCASession->GetEV();
- ODCanvas* canvas;
-
- CA_TRY
-
- if (visFrame)
- {
- canvas = ((ODFacet*) visFrame)->GetCanvas(ev);
- return (GrafPtr) canvas->GetPlatformCanvas(ev, (ODGraphicsSystem) graphicsSystem);
- }
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- return NULL;
- }
-
-
- //-------------------------------------------------------------------------
-
- pascal void
- CADrawFrame( CAVisFrame visFrame, RgnHandle invalidRgn )
- {
- Environment* ev = gCASession->GetEV();
- ODFacet* facet = (ODFacet*) visFrame;
- ODShape* invalShape = kODNULL;
- ODFacet* rootFacet = kODNULL;
-
- CA_TRY
-
- THROW_IF_NULL (facet);
-
- if (invalidRgn != NULL)
- {
- invalShape = facet->CreateShape (ev);
- THROW_IF_NULL (invalShape);
- invalShape->SetQDRegion (ev, invalidRgn);
- }
- else
- {
- invalShape = ODCopyAndRelease (ev, facet->AcquireClipShape (ev, kODNULL));
- }
-
- //rootFacet = facet->GetContainingFacet(ev);
- //TempODTransform xform = rootFacet->AcquireWindowFrameTransform(ev, kODNULL);
- //invalShape->InverseTransform(ev, xform);
-
- //rootFacet = facet->GetContainingFacet(ev);
- //TempODTransform wfXform = rootFacet->GetFrame(ev)->AcquireInternalTransform(ev, kODNULL);
- //invalShape->Transform(ev, wfXform);
-
- //facet->Draw (ev, invalShape, kODNULL);
- facet->Update (ev, invalShape, kODNULL);
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- ODFinalReleaseObject (ev, invalShape);
-
- }
-
- pascal void CADrawActiveBorder (void)
- {
-
- Environment* ev = gCASession->GetEV();
- ODArbitrator* arbitrator = gCASession->GetArbitrator();;
-
- CA_TRY
-
- TempODFrame tempFrame = arbitrator->AcquireFocusOwner (ev,
- gCASession->GetODSession()->Tokenize(ev, kODSelectionFocus));
-
- if (tempFrame)
- tempFrame->DrawActiveBorder (ev);
-
- CA_CATCH_ALL
- CA_ENDTRY
-
-
- }
-
- //-------------------------------------------------------------------------
-
- pascal void
- CAInstallCanvasNotification( CACanvasUpdatedProc proc,
- CADocumentRef document )
- {
- Environment* ev = gCASession->GetEV();
- CAProxyExtension* proxyExt = kODNULL;
-
- CA_TRY
-
- TempODPart tempPart = ((CADocument*)document)->AcquireRootPart();
- THROW_IF_NULL (tempPart);
-
- proxyExt = (CAProxyExtension*)tempPart->AcquireExtension( ev, kCAProxyPartExtension );
- THROW_IF_NULL (proxyExt);
-
- CACanvasUpdatedProcUPP canvasUpdatedUPPHandler;
-
- canvasUpdatedUPPHandler = (CACanvasUpdatedProcUPP) NewRoutineDescriptor((ProcPtr)proc,
- uppCACanvasUpdatedProcInfo,
- GetCurrentISA());
-
- proxyExt->InstallCACanvasUpdatedHandler( ev, canvasUpdatedUPPHandler);
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- ODReleaseObject (ev, proxyExt);
-
-
- }
-